'use strict';

const Controller = require('egg').Controller;

class BannerController extends Controller {
  async index() {
    const {ctx} = this
    var db = this.app.mongodb
    var res = await db.collection("banner").find().toArray()
    if(res.length){
        ctx.body = {
            status:200,
            res,
            msg:"banner"
        }
    }else{
        ctx.status = 400
        ctx.body = {
            status:400,
            msg:"数据库输入的参数不合法"
        }
    }
  }
}

module.exports = BannerController;
